package com.xy.model;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

/*
 * @入库表
 */
@SuppressWarnings("serial")
@Entity
@Table
@Cacheable
public class StockReceive extends Identified implements Serializable {
  @Column(nullable = false)
  private int amount;// 数量
  private String remark;// 备注
  @Column(nullable = false)
  private Date dateTime;// 入库时间
  // 对应到管理员
  @ManyToOne(targetEntity = Admin.class)
  @JoinColumn(name = "Admin_Id", referencedColumnName = "id")
  private Admin admin;
  // 对应到供应商
  @ManyToOne(targetEntity = Supplier.class)
  @JoinColumn(name = "Supplier_Id", referencedColumnName = "id")
  private Supplier supplier;
  // 对应到教材表
  @ManyToOne(targetEntity = TextBook.class)
  @JoinColumn(name = "TextBook_Id", referencedColumnName = "id")
  private TextBook textBook;
  // 对应到入库报销表
  @OneToMany(targetEntity = PayMent.class, mappedBy = "stockReceive") //
  private Set<PayMent> payments = new HashSet<PayMent>();

  public int getAmount() {
    return amount;
  }

  public void setAmount(int amount) {
    this.amount = amount;
  }

  public String getRemark() {
    return remark;
  }

  public void setRemark(String remark) {
    this.remark = remark;
  }

  public Date getDateTime() {
    return dateTime;
  }

  public void setDateTime(Date dateTime) {
    this.dateTime = dateTime;
  }

  public Admin getAdmin() {
    return admin;
  }

  public void setAdmin(Admin admin) {
    this.admin = admin;
  }

  public Supplier getSupplier() {
    return supplier;
  }

  public void setSupplier(Supplier supplier) {
    this.supplier = supplier;
  }

  public TextBook getTextBook() {
    return textBook;
  }

  public void setTextBook(TextBook textBook) {
    this.textBook = textBook;
  }

  public Set<PayMent> getPayments() {
    return payments;
  }

  public void setPayments(Set<PayMent> payments) {
    this.payments = payments;
  }

  public StockReceive() {
    super();
    // TODO Auto-generated constructor stub
  }

}
